<template>
  <page-header-wrapper>
    <a-card :bordered="false">
      <a-row :gutter="24" type="flex" justify="center">
        <a-col :order="isMobile ? 2 : 1" :md="24" :lg="24">
          <a-form layout="vertical" :form="form">
            <a-form-item>
              <a-input v-model="value" placeholder="请输入订单ID"/>
            </a-form-item>
            <a-form-item>
              <a-button type="primary" @click="handle()" :loading="loading">查询</a-button>
            </a-form-item>
          </a-form>
        </a-col>
        <a-col :order="1" :md="24" :lg="8" :style="{ minHeight: '180px' }"> </a-col>
      </a-row>
    </a-card>
  </page-header-wrapper>
</template>
  
  <script>
import { baseMixin } from '@/store/app-mixin'
import { orderQuickCheckUsingGET } from '@/api/api/qiantaizhangwu.ts'

export default {
  name: 'Wechat',
  mixins: [baseMixin],
  data() {
    return {
      // cropper
      preview: {},
      form: this.$form.createForm(this),
      loading: false,
      value:'',
      option: {
        img: '/avatar2.jpg',
        info: true,
        size: 1,
        outputType: 'jpeg',
        canScale: false,
        autoCrop: true,
        // 只有自动截图开启 宽度高度才生效
        autoCropWidth: 180,
        autoCropHeight: 180,
        fixedBox: true,
        // 开启宽度和高度比例
        fixed: true,
        fixedNumber: [1, 1],
      },
    }
  },
  methods: {
    handle() {
      this.loading = true,
      orderQuickCheckUsingGET({ orderId:this.value}).then((res) => {
        this.loading = false
         if(res.data == '1'){
           this.$router.push({ path: `/agent/order/${this.value}`  })
         }else if(res.data == '2'){
           this.$router.push({ path: `/purchasing/inStoreRecord/detail/${this.value}`  })
         }else if(res.data == '3' ){
           this.$router.push({ path: `/purchasing/ProtectPriceRecord/${this.value}`  })
         }else if(res.data == '4' ){
           this.$router.push({ path: `/wholesale/sellrecord/detail/${this.value}`  })
         }else if(res.data == '5' ){
           this.$router.push({ path: `/cashier/profile/index/${this.value}`  })
         }else if(res.data == '6' ){
           this.$router.push({ path: `/cashier/paymentRecord/detail/${this.value}`  })
         }else if(res.data == '7' ){
           this.$router.push({ path: `/shift/counterShiftRecord/detail/${this.value}`  })
         }else if(res.data == '8' ){
           this.$router.push({ path: `/service/service/detail/${this.value}`  })
         }
      })
      .catch((error) => {
        console.log(error)
        this.loading = false
        this.$message.error(((error.response || {}).data || {}).msg || '请求出现错误')
      })
    },
  },
}
</script>